home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 10SARUV (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  3.9 KB  |  114 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Point;
  5. import java.awt.Rectangle;
  6. import java.awt.event.InputEvent;
  7. import java.awt.event.MouseAdapter;
  8. import java.awt.event.MouseEvent;
  9. import java.awt.event.MouseMotionListener;
  10. import java.io.Serializable;
  11. import java.util.EventObject;
  12.  
  13. class BasicSplitPaneDivider$MouseHandler extends MouseAdapter implements MouseMotionListener, Serializable {
  14.    // $FF: synthetic field
  15.    BasicSplitPaneDivider this$0;
  16.  
  17.    public void mousePressed(MouseEvent e) {
  18.       if (((EventObject)e).getSource() == this.this$0.splitPane && this.this$0.dragger == null && this.this$0.splitPane.isEnabled()) {
  19.          Component newHiddenDivider = this.this$0.splitPaneUI.getNonContinuousLayoutDivider();
  20.          if (this.this$0.hiddenDivider != newHiddenDivider) {
  21.             if (this.this$0.hiddenDivider != null) {
  22.                this.this$0.hiddenDivider.removeMouseListener(this);
  23.                this.this$0.hiddenDivider.removeMouseMotionListener(this);
  24.             }
  25.  
  26.             this.this$0.hiddenDivider = newHiddenDivider;
  27.             if (this.this$0.hiddenDivider != null) {
  28.                this.this$0.hiddenDivider.addMouseMotionListener(this);
  29.                this.this$0.hiddenDivider.addMouseListener(this);
  30.             }
  31.          }
  32.  
  33.          if (this.this$0.splitPane.getLeftComponent() != null && this.this$0.splitPane.getRightComponent() != null) {
  34.             if (this.this$0.orientation == 1) {
  35.                this.this$0.dragger = new BasicSplitPaneDivider.DragController(this.this$0, e);
  36.             } else {
  37.                this.this$0.dragger = new BasicSplitPaneDivider.VerticalDragController(this.this$0, e);
  38.             }
  39.  
  40.             if (!this.this$0.dragger.isValid()) {
  41.                this.this$0.dragger = null;
  42.             } else {
  43.                this.this$0.prepareForDragging();
  44.                this.this$0.dragger.continueDrag(e);
  45.             }
  46.          }
  47.  
  48.          ((InputEvent)e).consume();
  49.       }
  50.  
  51.    }
  52.  
  53.    public void mouseReleased(MouseEvent e) {
  54.       if (this.this$0.dragger != null) {
  55.          if (((EventObject)e).getSource() == this.this$0.splitPane) {
  56.             this.this$0.dragger.completeDrag(e.getX(), e.getY());
  57.          } else if (((EventObject)e).getSource() == this.this$0.hiddenDivider) {
  58.             this.this$0.getLocation();
  59.             Point hDividerLoc = this.this$0.hiddenDivider.getLocation();
  60.             int ourX = e.getX() + hDividerLoc.x;
  61.             int ourY = e.getY() + hDividerLoc.y;
  62.             this.this$0.dragger.completeDrag(ourX, ourY);
  63.          }
  64.  
  65.          this.this$0.dragger = null;
  66.       }
  67.  
  68.       this.this$0.splitPane.setCursor(BasicSplitPaneDivider.defaultCursor);
  69.       ((InputEvent)e).consume();
  70.    }
  71.  
  72.    public void mouseDragged(MouseEvent e) {
  73.       if (this.this$0.dragger != null) {
  74.          if (((EventObject)e).getSource() == this.this$0.splitPane) {
  75.             this.this$0.dragger.continueDrag(e.getX(), e.getY());
  76.          } else if (((EventObject)e).getSource() == this.this$0.hiddenDivider) {
  77.             this.this$0.getLocation();
  78.             Point hDividerLoc = this.this$0.hiddenDivider.getLocation();
  79.             int ourX = e.getX() + hDividerLoc.x;
  80.             int ourY = e.getY() + hDividerLoc.y;
  81.             this.this$0.dragger.continueDrag(ourX, ourY);
  82.          }
  83.  
  84.          ((InputEvent)e).consume();
  85.       }
  86.  
  87.    }
  88.  
  89.    public void mouseMoved(MouseEvent e) {
  90.       if (this.this$0.dragger == null) {
  91.          int eventX = e.getX();
  92.          int eventY = e.getY();
  93.          Rectangle bounds = this.this$0.getBounds();
  94.          if (eventX >= bounds.x && eventX < bounds.x + bounds.width && eventY >= bounds.y && eventY < bounds.y + bounds.height) {
  95.             if (this.this$0.orientation == 1) {
  96.                if (this.this$0.splitPane.getCursor() != BasicSplitPaneDivider.horizontalCursor) {
  97.                   this.this$0.splitPane.setCursor(BasicSplitPaneDivider.horizontalCursor);
  98.                }
  99.             } else if (this.this$0.splitPane.getCursor() != BasicSplitPaneDivider.verticalCursor) {
  100.                this.this$0.splitPane.setCursor(BasicSplitPaneDivider.verticalCursor);
  101.             }
  102.          } else if (this.this$0.splitPane.getCursor() != BasicSplitPaneDivider.defaultCursor) {
  103.             this.this$0.splitPane.setCursor(BasicSplitPaneDivider.defaultCursor);
  104.          }
  105.  
  106.       }
  107.    }
  108.  
  109.    // $FF: synthetic method
  110.    BasicSplitPaneDivider$MouseHandler(BasicSplitPaneDivider this$0) {
  111.       this.this$0 = this$0;
  112.    }
  113. }
  114.